BLANK    [[:blank:]]*
NEWLINE  \n

CONSTANT "#"({DECCONST}|{HEXCONST})
DECCONST [[:digit:]]
HEXCONST [Xx][[:xdigit:]]
LABEL    "#"[[:alpha:]]+
REGISTER [Rr][0-4]

ADD [Aa][Dd][Dd]
SUB [Ss][Uu][Bb]
MOV [Mm][Oo][Vv]
CMP [Cc][Mm][Pp]
AND [Aa][Nn][Dd]
OR  [Oo][Rr]
NOT [Nn][Oo][Tt]
CLR [Cc][Ll][Rr]
NEG [Nn][Ee][Gg]
SHL [Ss][Hh][Ll]
SHR [Ss][Hh][Rr]
BRZ [Bb][Rr][Zz]
BRN [Bb][Rr][Nn]
BRE [Bb][Rr][Ee]
BRL [Bb][Rr][Ll]
BRG [Bb][Rr][Gg]
BRC [Bb][Rr][Cc]
JMP [Jj][Mm][Pp]

%%
    
{CONSTANT} { return CONSTANT; }
{LABEL}    { return LABEL;    }
{REGISTER} { return REGISTER; }

{ADD}      { return ADD;      }
{SUB}      { return SUB;      }
{MOV}      { return MOV;      }
{CMP}      { return CMP;      }
{AND}      { return AND;      }
{OR}       { return OR;       }
{NOT}      { return ADD;      }
{CLR}      { return CLR;      }
{NEG}      { return NEG;      }
{SHL}      { return SHL;      }
{SHR}      { return SHR;      }
{BRZ}      { return BRZ;      }
{BRN}      { return BRN;      }
{BRE}      { return BRE;      }
{BRL}      { return BRL;      }
{BRG}      { return BRG;      }
{BRC}      { return BRC;      }
{JMP}      { return JMP;      }

{NEWLINE}  { return NEWLINE;  }
{BLANK}    { return *yytext;  }
.          { return *yytext;  }
